package com.yc.Testjvm.proxy.demo1;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * 动态代理
 * @author yuancan
 *
 */
public class DynamicProxyHandle implements InvocationHandler {
	
	private Hello hello;
	public DynamicProxyHandle(Hello hello) {
		this.hello = hello;
	}

	@Override
	public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
		System.out.println("DynamicProxyHandle-----do some thing before");
		Object result = method.invoke(hello, args);
		System.out.println("DynamicProxyHandle-----do some thing after");
		return result;
	}

}
